package com.example.jdcompetition.Service.cvsPro.time;

import java.util.Objects;

/**
 * @author henrydai
 * @date 2021/6/4 19:17
 */
public class CollectTime implements Comparable{
    public long collectDeadline; //揽收截止时间
    public long collectTime;     //揽收时长
    public long effectiveDate;   //生效日期
    public long expirationDate;  //失效日期
    public CollectTime(long collectDeadline, long collectTime, long effectiveDate, long expirationDate)
    {
        this.collectDeadline=collectDeadline;
        this.collectTime=collectTime;
        this.effectiveDate=effectiveDate;
        this.expirationDate=expirationDate;
    }

    @Override
    public String toString() {
        return "CollectTime{" +
                "collectDeadline=" + collectDeadline +
                ", collectTime=" + collectTime +
                ", effectiveDate=" + effectiveDate +
                ", expirationDate=" + expirationDate +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CollectTime that = (CollectTime) o;
        return collectDeadline == that.collectDeadline && collectTime == that.collectTime && effectiveDate == that.effectiveDate && expirationDate == that.expirationDate;
    }

    @Override
    public int hashCode() {
        return Objects.hash(collectDeadline, collectTime, effectiveDate, expirationDate);
    }

    @Override
    public int compareTo(Object o) {
        CollectTime other = (CollectTime) o;
        if(this.effectiveDate> other.effectiveDate)
        {
            return 1;
        }
        else
        {
            return -1;
        }
    }
}
